nfs-kernel-server: fix build
authorJohn Audia <[email protected]>
Tue, 15 Jul 2025 14:05:43 +0000 (10:05 -0400)
committerTianling Shen <[email protected]>
Fri, 1 Aug 2025 02:05:08 +0000 (10:05 +0800)
Add nls.mk and patch to avoid the build ending in an error:
In function 'write_table',
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
rpc_tblout.c:91:26: error: '%s' directive writing likely 1 or more bytes into a region of size between 0 and 99 [-Werror=format-overflow=]
   91 |       s_print (progvers, "%s_%s",
      |                          ^
rpc_tblout.c:91:26: note: assuming directive output of 1 byte
In function 'sprintf',
    inlined from 'write_table' at rpc_tblout.c:91:7,
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
/scratch/union/staging_dir/toolchain-x86_64_gcc-15.1.0_glibc/include/bits/stdio2.h:30:10: note: '__builtin___sprintf_chk' output 2 or more bytes (assuming 102) into a destination of size 100
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^
lto1: some warnings being treated as errors
make[6]: *** [/scratch/union/tmp/ccHfYNRX.mk:2: /scratch/union/tmp/ccudJcWZ.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
mold: fatal: lto-wrapper failed

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Co-developed-by: Rosen Penev <[email protected]>
Signed-off-by: John Audia <[email protected]>
net/nfs-kernel-server/Makefile
net/nfs-kernel-server/patches/220-fix-ld-error.patch [new file with mode: 0644]

index a112c9a9186911368bd3eedf01d67f15b53f4acb..95d7aacb9764254889c1a97883773a7482852bc9 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nfs-kernel-server
 PKG_VERSION:=2.8.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_HASH:=11e7c5847a8423a72931c865bd9296e7fd56ff270a795a849183900961711725
 
 PKG_SOURCE_URL:=@KERNEL/linux/utils/nfs-utils/$(PKG_VERSION)
@@ -27,6 +27,7 @@ PKG_CONFIG_DEPENDS:= \
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
 
 define Package/nfs-kernel-server/Default
        SECTION:=net
diff --git a/net/nfs-kernel-server/patches/220-fix-ld-error.patch b/net/nfs-kernel-server/patches/220-fix-ld-error.patch
new file mode 100644 (file)
index 0000000..bca716c
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/tools/rpcgen/rpc_tblout.c
++++ b/tools/rpcgen/rpc_tblout.c
+@@ -82,14 +82,19 @@ write_table (const definition * def)
+   proc_list *proc;
+   int current;
+   int expected;
+-  char progvers[100];
++  char *progvers;
+   int warning;
++  int a;
+   for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
+     {
+       warning = 0;
+-      s_print (progvers, "%s_%s",
++     a = asprintf (&progvers, "%s_%s", 
+              locase (def->def_name), vp->vers_num);
++     if (a == -1)
++     {
++           return;
++     }
+       /* print the table header */
+       f_print (fout, tbl_hdr, progvers);
+@@ -146,6 +151,7 @@ write_table (const definition * def)
+       /* print the table trailer */
+       f_print (fout, tbl_end);
+       f_print (fout, tbl_nproc, progvers, progvers, progvers);
++      free (progvers);
+     }
+ }